<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/js/xadmin.js"></script>
</head>
<body>
<div class="x-body">
    <form class="layui-form">
        <!--userinfo的uId放入隐藏域-->
        <input type="hidden" name="userId" id="userId" th:value="${user.userId}">
        <!--文件上传的html代码-->

        <div class="layui-form-item">
            <label for="userName" class="layui-form-label">
                <span class="x-red">*</span>姓名
            </label>
            <div class="layui-input-inline">
                <input type="text" th:value="${user.userName}" id="userName" name="userName" readonly="" lay-verify="readonly"
                       autocomplete="off" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <label for="userBirth" class="layui-form-label">
                <span class="x-red">*</span>用户生日
            </label>
            <div class="layui-input-inline">
                <input type="text" th:value="${user.userBirth}" id="userBirth" name="userBirth" readonly="" lay-verify="readonly"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="userAddr" class="layui-form-label">
                <span class="x-red">*</span>用户住址
            </label>
            <div class="layui-input-inline">
                <input type="text" th:value="${user.userAddr}" id="userAddr" name="userAddr" readonly="" lay-verify="readonly"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="userIdenty" class="layui-form-label">
                <span class="x-red">*</span>用户身份证信息
            </label>
            <div class="layui-input-inline">
                <input type="text" th:value="${user.userIdenty}" id="userIdenty" name="userIdenty" readonly="" lay-verify="readonly"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="userTel" class="layui-form-label">
                <span class="x-red">*</span>用户电话
            </label>
            <div class="layui-input-inline">
                <input type="text" th:value="${user.userTel}" id="userTel" name="userTel" readonly="" lay-verify="readonly"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <button  class="layui-btn" lay-filter="save" lay-submit="">
            保存
        </button>

    </form>
</div>
</div>
</body>
</html>
<script>

    //form表单,layer弹出框
    layui.use(['form','layer'],function () {
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;


        //保存按钮
        form.on('submit(save)',function (data) {
            console.log(data);

            $.ajax({
                url:"/user/edit",
                type:"POST",
                dataType:"json",
                data:data.field,
                success:function (data) {
                    //提示信息
                    layer.alert(data.info);
                    //放入了map中，调用info
                    if (data.info=="修改成功"){
                        //获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        //刷新
                        parent.window.location.replace("/staffInfoDetail/list")
                    }
                }

            })

            return false;
        });
    });

    //

</script>